package cn.shopping.service.impl.login;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.shopping.dao.login.adminMapper;
import cn.shopping.pojo.Admin_type;
import cn.shopping.pojo.Admin_user;
import cn.shopping.service.login.adminService;

@Service
public class adminServiceImpl implements adminService {

	@Autowired
	private adminMapper adminmapper;
	@Override
	public Admin_user getuser(String usercode) {
		return adminmapper.sellogin(usercode);
	}
	@Override
	public List<Admin_type> getalltype() {
		return adminmapper.selalltype();
	}
	@Override
	public List<Admin_user> getalluser(int role) {
		return adminmapper.selalladmin(role);
	}
	@Override
	public boolean addadmin(Admin_user users) {
		boolean flag = false;
		int num = adminmapper.addadmins(users);
		if (num>0) {
			flag = true;
		}
		return flag;
	}
	@Override
	public Admin_user getuserByid(Integer id) {
		return adminmapper.seladminbyid(id);
	}
	@Override
	public boolean modifyadmin(Admin_user users) {
		boolean flag = false;
		int num = adminmapper.modifyguanliyuan(users);
		if (num>0) {
			flag = true;
		}
		return flag;
	}
	@Override
	public boolean deladmins(Integer id) {
		boolean flag = false;
		int num = adminmapper.deladmin(id);
		if (num>0) {
			flag = true;
		}
		return flag;
	}
	
	

}
